import { UserLayout, TabLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'

/**
 * 走菜单，走权限控制
 * @type {[null,null]}
 */
export const asyncRouterMap = [
  {
    path: '/',
    name: 'dashboard',
    component: TabLayout,
    meta: { title: '首页' },
    redirect: '/dashboard/analysis',
    children: [
      // {
      //   path: 'business',
      //   name: 'business',
      //   component: () => import('@/views/business/XiTongPeiZhi')
      // }
    ],
  },
  // 开帐操作
  // {
  //   path: '/',
  //   name: 'business',
  //   component: TabLayout,
  //   children: [
  //     {
  //       path: '',
  //       name: 'index',
  //       component: () => import('@/views/business/XiTongPeiZhi'),
  //       meta: { title: '开帐操作' },
  //       hidden: true
  //     }
  //   ]
  // },
  {
    path: '*',
    redirect: '/404',
    hidden: true,
  },
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login'),
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/register/Register'),
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/register/RegisterResult'),
      },
      {
        path: 'alteration',
        name: 'alteration',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/alteration/Alteration'),
      },
      {
        path: 'account',
        name: 'account',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/createAccount'),
      },
    ],
  },
  {
    path: '/',
    name: 'dashboard',
    component: TabLayout,
    hidden: true,
    meta: { title: '首页' },
    redirect: '/dashboard/analysis',
    children: [
      {
        path: 'sale',
        name: 'sale',
        meta: { title: '销售管理' },
        component: () => import('@/components/layouts/menu/saleMenu'),
      },
      {
        path: 'purchase',
        name: 'purchase',
        meta: { title: '采购管理' },
        component: () => import('@/components/layouts/menu/purchaseMenu'),
      },
      {
        path: 'stock',
        name: 'stock',
        meta: { title: '库存管理' },
        component: () => import('@/components/layouts/menu/stockMenu'),
      },
      {
        path: 'payment',
        name: 'payment',
        meta: { title: '财务管理' },
        component: () => import('@/components/layouts/menu/paymentMenu'),
      },
      {
        path: 'reportStatistics',
        name: 'reportStatistics',
        meta: { title: '报表统计' },
        component: () => import('@/components/layouts/menu/reportStatisticsMenu'),
      },
      {
        path: 'baseInfomation',
        name: 'baseInfomation',
        meta: { title: '基本信息' },
        component: () => import('@/components/layouts/menu/baseInfomationMenu'),
      },
      {
        path: 'shopManage',
        name: 'shopManage',
        meta: { title: '商城管理' },
        component: () => import('@/components/layouts/menu/shopManageMenu'),
      }
    ],
  },
  // {
  //   path: '/',
  //   name: 'index',
  //   component: TabLayout,
  //   meta: {title: '首页'},
  //   redirect: '/dashboard/workplace',
  //   children: [
  //     {
  //       path: '/online',
  //       name: 'online',
  //       redirect: '/online',
  //       component: RouteView,
  //       meta: {title: '在线开发', icon: 'dashboard', permission: ['dashboard']},
  //       children: [
  //         {
  //           path: '/online/auto/:code',
  //           name: 'report',
  //           component: () => import('@/views/modules/online/cgreport/OnlCgreportAutoList')
  //         },
  //       ]
  //     },
  //   ]
  // },

  {
    // OAuth2 APP页面路由
    path: '/oauth2-app',
    component: BlankLayout,
    redirect: '/oauth2-app/login',
    children: [
      {
        // OAuth2 登录路由
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "oauth2-app.login" */ '@/views/user/oauth2/OAuth2Login'),
      },
    ],
  },

  {
    path: '/test',
    component: BlankLayout,
    redirect: '/test/home',
    children: [
      {
        path: 'home',
        name: 'TestHome',
        component: () => import('@/views/Home'),
      },
    ],
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
  },
]

